<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta name="decorator" content="sysDefault" />
<style type="text/css">

</style>
<script type="text/javascript">

	function funform(url,target){
		window.open(url,target);
	}
	
</script>
</head>
<body>
<form:form name="listForm" modelAttribute="bpmDef" method="post" class="form-inline" role="form">
	<div class="container-fluid">
		<div class="row">
			<div class="col-xs-12">
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">
				    	流程定义列表
				    	<shiro:hasPermission name="com.maoye.ossp.bpm.workflow.design">
				    		<button class="btn btn-success btn-sm pull-right" role="button" onclick="funform('${contextPath}/bpm/def/definition/design','_blank');">在线设计器</button>
				    	</shiro:hasPermission>
				    </h3> 
				  </div>
				  	<div class="navbar-form">
				   		<div class="form-group">
						   <form:input id="name" path="name"  class="form-control" placeholder="流程名称"/>
						</div>
						<div class="form-group">
						   <form:input id="defKey" path="defKey"  class="form-control" placeholder="流程定义主键"/>
						</div>
						<button type="submit" class="btn btn-primary" id="queryBtn">查询</button>
				  	</div>
					<tags:message content="${message}" />
					<table class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th>流程定义ID</th>
								<th>流程名称</th>
								<th>流程业务主键</th>
								<th>创建时间</th>
								<th>更新时间</th>
								<th>流程状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${page.list}" var="def">
								<tr>
									<td>${def.defId}</td>
									<td>${def.name}</td>
									<td>${def.defKey}</td>
									<td><fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${def.createTime}"/></td>
									<td><fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${def.updateTime}"/></td>
									<td><ossp:value dictType="BPM_DEF_STATUS" key="${def.status}"></ossp:value></td>									
									<td>
										
										<shiro:hasPermission name="com.maoye.ossp.bpm.workflow.view">
								    		<a href="${contextPath}/bpm/def/definition/${def.defId}/view">查看</a>
								    	</shiro:hasPermission>
										<shiro:hasPermission name="com.maoye.ossp.bpm.workflow.edit">
								    		<a href="${contextPath}/bpm/def/definition/${def.defId}/edit">修改</a>
								    	</shiro:hasPermission>
										<shiro:hasPermission name="com.maoye.ossp.bpm.workflow.design">
								    		<a href="${contextPath}/bpm/def/definition/design?defId=${def.defId}" target="_blank">设计</a>
								    	</shiro:hasPermission>
										<shiro:hasPermission name="com.maoye.ossp.bpm.workflow.delete">
								    		<a href="${contextPath}/bpm/def/definition/${def.defId}/delete"
										   onclick="return Oosp_Confirm('确认要删除该条数据吗？', this.href)">删除</a>
								    	</shiro:hasPermission>
										
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					  <div class="panel-footer">
					  	<pager:pager pageSize="${page.pageSize}" pageNo="${page.pageNo}" url="" total="${page.total}"/>
						<script type="text/javascript" src="${staticPath}/js/list.js"></script>
					  </div>
				</div>			
			</div>
		</div>
	</div>
				    </form:form>
</body>
</html>